package com.sfac.hqyj.springBoot.config.alipay;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlipayConfig {
    @Autowired
    private AlipayConfigBean alipayConfigBean;

    @Bean
    public AlipayClient alipayClient () {
        return new DefaultAlipayClient(
                alipayConfigBean.getAlipayGateway(),
                alipayConfigBean.getAppId(),
                alipayConfigBean.getPrivateKey(),
                alipayConfigBean.getFormat(),
                alipayConfigBean.getCharset(),
                alipayConfigBean.getAlipayPublicKey(),
                alipayConfigBean.getSignType());
    }
}
